﻿using System.Web.Mvc;

namespace QG.FrontDesk.com.Attbutes
{
    /// <summary>
    /// 动作过滤器
    /// </summary>
    public class ActionAttribute : ActionFilterAttribute
    {
        string operation;
        public ActionAttribute(string operation)
        {
            this.operation = operation;
        }
        /// <summary>
        /// 之后
        /// </summary>
        /// <param name="context"></param>
        //public override void OnActionExecuted(ActionExecutedContext filterContext)
        //{
        //    //时间
        //    DateTime operationDate = DateTime.Now;
        //    //当前管理员
        //    string AdminName = DataContext<UserInfo>.context.user.AdminName;
        //    OpercteResult opercteResult = new OpercteResult();
        //    if (filterContext.Result.ToString().Equals("System.Web.Mvc.JsonResult"))
        //    {
        //        opercteResult = ((JsonResult)filterContext.Result).Data as OpercteResult;
        //    }
        //    string state = opercteResult.Success ? "成功" : "失败";
        //    ILogService logService = new LogService(new LogRepository());
        //    logService.InsertLog(new Model.Log() { AdminName = AdminName, Operation = operation, OperationDate = operationDate,Detailed= opercteResult.Operation,State= state });
        //}
    }
}